$('#narsis').datagrid({
				title:'List Foto Narsis',
				//iconCls:'icon-ok',
				width:'auto',
				height:tinggi-200,
				nowrap: false,
				autoRowHeight: false,
				striped: true,
				collapsible:false,
				singleSelect:true,
				url: host+'backend/get_data/tbl_narsis/',
				pagination:"true",
				queryParams:{
					
				},
			toolbar:[
					 {
						iconCls:'add',
						text:'Tambah',
						id:'add_data', 
						handler:function(){
							get_form(host+'backend/get_crud/tbl_narsis/add/','',600,210,'Tambah Foto Narsis');	
						}
					 },'-',
					 {
						text:'Edit',
						iconCls:'building_edit',
						id:'edit_data',
						handler:function(){
							cek_grid('edit','Edit Data Foto Narsis');
						}
					
					 },'-',
					 {
						text:'Hapus',
						iconCls:'delete',
						handler:function(){
							cek_grid('delete','Hapus Data Reseller Produk');
						}
					 },'-'
				
			],	

				columns:[[
					{field:'ck', checkbox:true},
					
					{field:'gambar_narsis' ,title:'Gambar', width:150, sortable:true,align:'center'
						,formatter:function(value,rowData,rowindex){
							if(value!='') return '<img src="'+host+'repositori/narsis/'+value+'" id="gambar_1" height="100" width="100" class="gambar_kecil">';
							else return 'Tidak Ada Gambar';
						}
					},
					{field:'deskripsi' ,title:'Deskripsi', width:350, sortable:true,align:'left'},
					{field:'tgl_buat' ,title:'Tanggal Buat', width:150, sortable:true,align:'center'},
				]]
});

function cek_grid(tbl,jdl){
		row = $('#narsis').datagrid('getSelected');
		if(row){
			if(tbl=='delete'){
				$.messager.confirm('Confirm','Yakin Data Porto Folio Akan Dihapus ?',function(r){  
					if (r==true){  
					  	$.post(host+'backend/hapus/tbl_narsis',{id:row.id,file:row.gambar_narsis},function(resp){
							if(resp==1){$.messager.alert("Data","Data Sudah Terhapus",'info');$('#narsis').datagrid('reload');}		   
						});	
					}  
				}); 
			}
			else if(tbl=='edit'){
				get_form(host+'backend/get_crud/tbl_narsis/'+tbl+'/'+row.id,'',600,210,jdl);
				//get_form(host+'modul/get_form/add_produk/'+tbl+'/'+row.id_produk); 
			}
			
			else if(tbl=='lihat'){
				window.open(host+'frontend/product/'+row.id);
			}
		}
		else{$.messager.alert("Data","Pilih Salah Satu Data",'error');}
}